package com.agileplex.codeminer.scm.svn;

import com.agileplex.codeminer.commons.MapContainer;
import com.agileplex.codeminer.scm.IVersionFS;

/**
 * Subversion file structure
 *
 * @creator yinwm
 * @date 2007-6-6
 *
 * @lastmodified
 * @author $Author: yinweiming $
 * @version $Revision: 15 $, $Date: 2007-07-16 18:12:59 +0000 (Mon, 16 Jul 2007) $
 */
public class SvnVersionFS implements IVersionFS<SvnVersion, String> {

	static MapContainer<SvnRepository, SvnVersion, SvnDirectory> mc = new MapContainer<SvnRepository, SvnVersion, SvnDirectory>();
	
	protected SvnRepository repository;
	public SvnVersionFS(SvnRepository repository) {
		this.repository = repository;
	}
	
	public void setRootDir(SvnDirectory d) {
		mc.set(repository, d.getVersion(), d);
	}

	public SvnDirectory getRootDir(SvnVersion v) {
		if (ready(v)) {
			return mc.get(repository, v);
		} else {
			return null;
		}
	}

	public boolean ready(SvnVersion v) {
		return mc.get(repository, v) != null;
	}
	
	public String getIdentifier() {
		return repository.getUniqId();
	}
}
